/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package CONTROLLER;

import DAO.DaoCargo;
import MODEL.Cargo;
import VIEW.ProjetoFinal;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javax.swing.JOptionPane;

/**
 *
 * @author MatheuseJessica
 */
public class CadastroCargoController implements Initializable{
    @FXML
    ComboBox cb_cargo;
    @FXML
    TextField tf_descricao;
    
    @FXML
    public void voltarCaixa(ActionEvent event){
        ProjetoFinal.getInstance().gotoCadastraFuncionario();
    }
    
    @FXML
    public void cadastrar(ActionEvent event){
       if(!tf_descricao.getText().isEmpty()){
            Cargo c = new Cargo();
            DaoCargo dc = new DaoCargo();
            c.setDescricao(tf_descricao.getText());
            dc.insereCargo(c);
            ProjetoFinal.getInstance().gotoCadastraFuncionario();
       }else{
           JOptionPane.showMessageDialog(null, "Digite a descrição");
       }
        
    }
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        
    }
    
}
